this._targetApp = null;
this._appMenuNotifyId = 0;
this._actionGroupNotifyId = 0;
+ this._busyNotifyId = 0;
let bin = new St.Bin({ name: 'appMenu' });
bin.connect('style-changed', Lang.bind(this, this._onStyleChanged));
this._targetApp.disconnect(this._actionGroupNotifyId);
this._actionGroupNotifyId = 0;
}
+ if (this._busyNotifyId) {
+ this._targetApp.disconnect(this._busyNotifyId);
+ this._busyNotifyId = 0;
+ }
this._targetApp = targetApp;
if (this._targetApp) {
this._appMenuNotifyId = this._targetApp.connect('notify::menu', Lang.bind(this, this._sync));
this._actionGroupNotifyId = this._targetApp.connect('notify::action-group', Lang.bind(this, this._sync));
+ this._busyNotifyId = this._targetApp.connect('notify::busy', Lang.bind(this, this._sync));
this._label.setText(this._targetApp.get_name());
this.actor.set_accessible_name(this._targetApp.get_name());
}
let isBusy = (this._targetApp != null &&
(this._targetApp.get_state() == Shell.AppState.STARTING ||
- this._targetApp.get_state() == Shell.AppState.BUSY));
+ this._targetApp.get_busy()));
if (isBusy)
this.startAnimation();
else
enum {
PROP_0,
PROP_STATE,
+ PROP_BUSY,
PROP_ID,
PROP_DBUS_ID,
PROP_ACTION_GROUP,
case PROP_STATE:
g_value_set_enum (value, app->state);
break;
+ case PROP_BUSY:
+ g_value_set_boolean (value, shell_app_get_busy (app));
+ break;
case PROP_ID:
g_value_set_string (value, shell_app_get_id (app));
break;
case SHELL_APP_STATE_STARTING:
break;
case SHELL_APP_STATE_RUNNING:
- case SHELL_APP_STATE_BUSY:
shell_app_activate_window (app, NULL, timestamp);
break;
}
g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0);
}
+gboolean
+shell_app_get_busy (ShellApp *app)
+{
+ if (app->running_state != NULL &&
+ app->running_state->application_proxy != NULL &&
+ shell_org_gtk_application_get_busy (app->running_state->application_proxy))
+ return TRUE;
+
+ return FALSE;
+}
+
static void
busy_changed_cb (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
- ShellOrgGtkApplication *proxy;
ShellApp *app = user_data;
- g_assert (SHELL_IS_ORG_GTK_APPLICATION (object));
g_assert (SHELL_IS_APP (app));
- proxy = SHELL_ORG_GTK_APPLICATION (object);
- if (shell_org_gtk_application_get_busy (proxy))
- shell_app_state_transition (app, SHELL_APP_STATE_BUSY);
- else
- shell_app_state_transition (app, SHELL_APP_STATE_RUNNING);
+ g_object_notify (G_OBJECT (app), "busy");
}
static void
G_CALLBACK (busy_changed_cb),
app);
if (shell_org_gtk_application_get_busy (proxy))
- shell_app_state_transition (app, SHELL_APP_STATE_BUSY);
+ g_object_notify (G_OBJECT (app), "busy");
}
if (app->running_state != NULL)
SHELL_APP_STATE_STOPPED,
G_PARAM_READABLE));
+ /**
+ * ShellApp:busy:
+ *
+ * Whether the application has marked itself as busy.
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_BUSY,
+ g_param_spec_boolean ("busy",
+ "Busy",
+ "Busy state",
+ FALSE,
+ G_PARAM_READABLE));
+
/**
* ShellApp:id:
*
typedef enum {
SHELL_APP_STATE_STOPPED,
SHELL_APP_STATE_STARTING,
- SHELL_APP_STATE_RUNNING,
- SHELL_APP_STATE_BUSY
+ SHELL_APP_STATE_RUNNING
} ShellAppState;
GType shell_app_get_type (void) G_GNUC_CONST;
void shell_app_update_window_actions (ShellApp *app, MetaWindow *window);
void shell_app_update_app_menu (ShellApp *app, MetaWindow *window);
+gboolean shell_app_get_busy (ShellApp *app);
+
G_END_DECLS
#endif /* __SHELL_APP_H__ */